/* Copyright (C) 2005-2013, Unigine Corp. All rights reserved.
 *
 * File:    fragment_base_volume.shader
 * Desc:    Particles base volume shader
 * Version: 1.03
 * Author:  Alexander Zapryagaev <frustum@unigine.com>
 *
 * This file is part of the Unigine engine (http://unigine.com/).
 *
 * Your use and or redistribution of this software in source and / or
 * binary form, with or without modification, is subject to: (i) your
 * ongoing acceptance of and compliance with the terms and conditions of
 * the Unigine License Agreement; and (ii) your inclusion of this notice
 * in any version of this software that you use or redistribute.
 * A copy of the Unigine License Agreement is available by contacting
 * Unigine Corp. at http://unigine.com/
 */

/******************************************************************************\
*
* OpenGL/OpenGLES
*
\******************************************************************************/

#ifdef OPENGL || OPENGLES
	
	#ifdef VOLUME
		fixed4 deferred_depth = texture2DProj(s_texture_5,s_texcoord_7);
		half depth = getDeferredDepth(deferred_depth) - length(s_texcoord_3.xyz);
		color *= saturate(depth * s_texcoord_3.w);
	#endif
	
/******************************************************************************\
*
* Direct3D11/Direct3D119
*
\******************************************************************************/

#elif DIRECT3D11 || DIRECT3D119
	
	#ifdef VOLUME
		half4 deferred_depth = s_texture_5.Sample(s_sampler_5,IN.texcoord_7.xy / IN.texcoord_7.w);
		half depth = getDeferredDepth(deferred_depth) - length(IN.texcoord_3.xyz);
		color *= saturate(depth * IN.texcoord_3.w);
	#endif
	
#endif
